package com.zhxymm.book.service;

import com.zhxymm.book.dao.UserAccountRepository;
import com.zhxymm.book.entity.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserAccountService {

    @Autowired
    UserAccountRepository userAccountRepository;

    public UserAccount save(UserAccount userAccount){
        return userAccountRepository.save(userAccount);
    }

    public List<UserAccount> getAll(){
        return userAccountRepository.findAll();
    }

    public UserAccount findByUserAccount(long theId) {
        return userAccountRepository.findByUserAccountId(theId);
    }

    public void delete(UserAccount theUserAccount) {
        userAccountRepository.delete(theUserAccount);
    }

    public UserAccount findByUserAccountId(long theId) {
        return userAccountRepository.findByUserAccountId(theId);
    }
}
